﻿<navigation:Page 
    x:Class="ibba.src.noriskbo.views.PagePendenciaEnquadramento" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:local="clr-namespace:ibba.src.noriskbo"    
    xmlns:dataPrimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"    
    xmlns:ig="http://schemas.infragistics.com/xaml"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
    xmlns:behavior="clr-namespace:ibba.src.noriskbo.code.behavior"
    Title="Enquadramento Manual"
    d:DesignWidth="960" d:MinHeight="550" 
    FontSize="10.667">
    
    <navigation:Page.Resources>
        <Style x:Key="CenterAlignStyle" TargetType="TextBlock">
            <Setter Property="TextAlignment" Value="Center" />
        </Style>
        
        <Style x:Key="WordWrapp" TargetType="TextBlock"> 
            <Setter Property="TextWrapping" Value="Wrap" />
        </Style>
        
        <Style TargetType="dataPrimitives:DataGridColumnHeader" x:Key="headerStyle">
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" TextWrapping="Wrap" HorizontalAlignment="Center" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </navigation:Page.Resources>
	
    <Grid x:Name="LayoutRoot" Margin="0,0,0,20"> <!-- Background="#FFE7E7EF"> -->
        <Grid.RowDefinitions>
            <RowDefinition Height="0" />
            <RowDefinition Height="0.497*" />
            <RowDefinition Height="0" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10" />
            <ColumnDefinition Width="0.918*" />
            <ColumnDefinition Width="10" />
        </Grid.ColumnDefinitions>

        <toolkit:BusyIndicator x:Name="activity" 
                               Grid.Row="1" Grid.RowSpan="2" Grid.Column="1">
            <Grid Margin="0,0,0,0" Background="#FFFFFFFF" Grid.Column="1" Grid.Row="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="40" />
                    <RowDefinition Height="0.5*" />
                </Grid.RowDefinitions>
                
                <Grid Grid.RowSpan="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <!--<RowDefinition Height="40" />-->
                    </Grid.RowDefinitions>

                    <Grid Name="spOperacoes">
                        <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,5,0,0">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Name="lblOperacoes" Text="Operacoes" Foreground="#FFE78E21" FontSize="14" />
                                <sdk:Label Name="lblOperacoesSelecionadas" Content="0" Style="{StaticResource LegendBlue}" 
                                           HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,-3,2,0"
                                           ToolTipService.ToolTip="Qtd. Operações Selecionadas"/>
                            </StackPanel>
                            <Border Style="{StaticResource LineGold}" HorizontalAlignment="Left"/>

                            <CheckBox Name="chkSelecionarTodos" Content="Selecionar todos" 
                                      HorizontalAlignment="Left" Margin="6,1,0,0"                                       
                                      Click="chkSelecionarTodos_Click" />
                            
                        </StackPanel>

                        <Border Style="{StaticResource borderOpcaoFiltro}"
                                HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="2,2,5,-2">
                            
                            <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" Height="16">
                                <TextBlock Text="Filtro: " HorizontalAlignment="Left" Style="{StaticResource SubTitleHeader}" FontSize="11" Height="16"/>
                                <Image Source="{StaticResource IconeFiltro}" Height="16" Width="16" />

                                <CheckBox Name="chkFiltroEnquadrado" Content="Enquadradas"
                                          IsChecked="true" Margin="10,0,0,0" Foreground="Black" 
                                          Click="FiltroGridOperacao_Click"/>
                                <CheckBox Name="chkFiltroNaoEnquadrado" Content="Não Enquadradas"
                                          IsChecked="true" Margin="10,0,0,0" Foreground="Black" 
                                          Click="FiltroGridOperacao_Click" />

                                <TextBlock Text="|" Style="{StaticResource SubTitleHeader}" FontSize="12" VerticalAlignment="Top" Margin="10,0,0,0"/>

                                <CheckBox Name="chkFiltroMeus" Content="Meus rascunhos"                                          
                                          IsChecked="true" Margin="10,0,0,0" Foreground="Black" 
                                          Click="FiltroGridOperacao_Click"/>
                                <CheckBox Name="chkFiltroOutros" Content="Outros rascunhos"
                                          IsChecked="true" Margin="10,0,0,0" Foreground="Black" 
                                          Click="FiltroGridOperacao_Click"/>
                            </StackPanel>
                        </Border>
                    </Grid>
                    
                    <TextBlock Name="lblNenhumRegistroEncontrado" Text="Nenhum registro encontrado." Grid.Row="1" Margin="5,10,0,0" FontSize="12" Visibility="Collapsed" />
                    <ig:XamGrid Name="xgOperacoes" Grid.Row="1" VerticalAlignment="Top" Margin="0,0,0,31"
                                GroupByCollectionChanged="xgOperacoes_GroupByCollectionChanged" 
                                CellDoubleClicked="xgOperacoes_CellDoubleClicked">
                        <i:Interaction.Behaviors>
                            <behavior:XamGridBehavior x:Name="xgOperacoesBehavior" IsExpandRowGrouped="True" />
                        </i:Interaction.Behaviors>

                        <ig:XamGrid.Columns>
                            <ig:TemplateColumn Key="Selecionado" HeaderText=" " Width="30" IsFilterable="False" IsGroupable="False" IsResizable="False" IsHideable="False">
                                <!--<ig:TemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <CheckBox x:Name="chkSelectAll" Content="" VerticalAlignment="Center" HorizontalAlignment="Center"
                                                  Click="chkSelectAll_Click"/>
                                    </DataTemplate>
                                </ig:TemplateColumn.HeaderTemplate>-->
                                <ig:TemplateColumn.ItemTemplate>
                                    <DataTemplate>
                                        <CheckBox Name="chkOperacao" HorizontalAlignment="Center" VerticalAlignment="Center"
                                                  IsChecked="{Binding Path=Selecionado, Mode=TwoWay}"
                                                  Click="chkOperacao_Click" IsEnabled="{Binding IsSelectable}"/>
                                    </DataTemplate>
                                </ig:TemplateColumn.ItemTemplate>
                            </ig:TemplateColumn>

                            <ig:TemplateColumn HeaderText="Data Solicitação" Key="DataSolicitacao" HorizontalContentAlignment="Center">                                               
                                <ig:TemplateColumn.FilterEditorTemplate>
                                    <DataTemplate>
                                        <TextBox Text="{Binding Value, Converter={StaticResource DateTimeConverter}, Mode=TwoWay}"/>
                                    </DataTemplate>
                                </ig:TemplateColumn.FilterEditorTemplate>
                                <ig:TemplateColumn.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding DataSolicitacao, Converter={StaticResource DateTimeConverter}, ConverterParameter='exibirHoje'}"
                                                   Foreground="{Binding DataSolicitacao, Converter={StaticResource DateTimeConverter}, ConverterParameter='destaqueHoje'}" 
                                                   VerticalAlignment="Center" HorizontalAlignment="Center" />
                                    </DataTemplate>
                                </ig:TemplateColumn.ItemTemplate>
                            </ig:TemplateColumn>
                            
                            <ig:TextColumn HeaderText="Nome Grupo"              Key="NomeGrupo"                 MinimumWidth="150" TextWrapping="Wrap" />
                            <ig:TextColumn HeaderText="Id Sublimite"            Key="IdSubLimite"               Visibility="Collapsed" />
                            <ig:TextColumn HeaderText="Contrato"                Key="CodigoContrato"            MinimumWidth="120" TextWrapping="Wrap" />
                            <ig:TextColumn HeaderText="Produto / Modalidade"    Key="CodigoProdutoModalidade"   MinimumWidth="150" TextWrapping="Wrap" />
                            <ig:TextColumn HeaderText="Sublimite atual"         Key="SubLimite"                 MinimumWidth="170" Width="0.50*" TextWrapping="Wrap" />
                            <ig:TextColumn HeaderText="Enquadramento manual"    Key="SubLimiteReenquadrado"     MinimumWidth="170" Width="0.50*" TextWrapping="Wrap" />
                            <ig:TextColumn HeaderText="Justificativa"           Key="Justificativa"             MinimumWidth="120" TextWrapping="Wrap" />
                            <ig:TextColumn HeaderText="Usuário"                 Key="NomeUsuario"               MinimumWidth="120" TextWrapping="Wrap" />

                        </ig:XamGrid.Columns>
                    </ig:XamGrid>
                    <local:XamGridToolBar x:Name="xgOperacoesTools" Grid.Row="1" VerticalAlignment="Bottom" Visibility="{Binding Visibility, ElementName=xgOperacoes}"/>
                </Grid>
            </Grid>
        </toolkit:BusyIndicator>

    </Grid>
</navigation:Page>